@echo off
:: 加载环境变量
for /f "delims=" %%x in (.env) do set "%%x"

:: 查找并终止指定端口进程
for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":%PORT%" ^| findstr "LISTENING"') do (
    taskkill /F /PID %%a 2>nul
    echo Terminated process with PID %%a (Port: %PORT%)
)

:: 英文提示
echo Process using port %PORT% has been stopped.
pause

:: 恢复原来的代码页
chcp %oldCP% >nul